package com.kucowka.db.entities;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.AccessType;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;

import com.kucowka.validators.Capitalized;
import com.kucowka.validators.UserValid;

@UserValid
@Entity
@Table(name = "User")
public class User implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5486833385155673447L;

	@Capitalized
	@Column
	private String name;

	@Email
	@NotNull
	@NotEmpty
	@Column
	private String email;

	@Id
	@Column
	@GeneratedValue(strategy=GenerationType.AUTO)
	@AccessType("field")
	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		this.id = id;
	}

	private int id;
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Override
	public String toString() {
		return "User [id=" + id + ", name=" + name + "]";
	}

}
